package 剑指offer;

import java.util.Stack;

public class 剑指offer06逆向打印链表 {
    public static int[] reversePrint(ListNode head) {
        int count = 0;
        ListNode temp = head;
        while (temp != null){
            count++;
            temp = temp.next;
        }
        int[] arr = new int[count];
        for (int i = count; i >= 0 ; i--) {
            arr[i] = head.val;
            head = head.next;
        }
        return arr;
    }
}

